package cn.dengta.webapp.im.entity;

import java.util.Date;

import cn.dengta.common.model.Status;
import cn.dengta.common.util.BeanUtil;
import cn.dengta.webapp.base.entity.BaseEntity;
import cn.dengta.webapp.im.form.GroupForm;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * 群组信息修改记录表
 *
 * @author zw
 * @since 2022-07-11
 */
@Setter
@Getter
@Accessors(chain = true)
@TableName("im_group_edit_log")
public class GroupEditLog extends BaseEntity {

	private static final long serialVersionUID = 1L;

	/** 简介 */
	private String intro;
	/** 群id */
	private Long groupId;
	/** 群名称 */
	private String name;
	/** 群图标 */
	private String icon;
	/** 创建人 */
	private Long addUserId;
	/** 业务状态 */
	private Integer status;
	/** 添加时间 */
	private Date addTime;

	public static final String INTRO = "intro";
	public static final String GROUP_ID = "group_id";
	public static final String NAME = "name";
	public static final String ICON = "icon";
	public static final String ADD_USER_ID = "add_user_id";
	public static final String STATUS = "status";
	public static final String ADD_TIME = "add_time";

	public static GroupEditLog of(GroupForm groupForm) {
		GroupEditLog groupEditLog = new GroupEditLog();
		BeanUtil.copyProperties(groupForm, groupEditLog);
		groupEditLog.setStatus(Status.NO.value);
		groupEditLog.setAddTime(new Date());
		return groupEditLog;
	}

}
